<div>
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <form class="form-horizontal adminex-form" onsubmit="return false;">
                    <div class="form-group">
                        <h4 class="h4-sty">运费管理</h4>
                    </div>
                    <div class="form-group">
                        <table class="table table-bordered table-striped table-condensed cf">
                            <tr>
                                <th style="text-align:center;" width="90%">区域</th>
                                <th width="5%">运费</th>
                                <th width="5%">免运金额</th>
                            </tr>
                            <?php foreach ($this->area_list as $k => $v){ ?>
                                <tr>
                                    <td width="90%"><?php echo $v['name']?></td>
                                    <td class="freight" rel="<?php echo $v['id']?>" width="5%"><input type="text" name="freight[<?php echo $v['id'] ?>]" value="<?php echo $v['freight']; ?>" /></td>
                                    <td class="free_freight" rel="<?php echo $v['id']?>" width="5%"><input type="text" name="free_freight[<?php echo  $v['id'] ?>]" value="<?php echo $v['free_freight']; ?>"/></td>
                                </tr>
                            <?php } ?>
                        </table>
                    </div>
                    <button style="float:right;margin-right: 2%" class="btn btn-success submit" type="button">提 交</button>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('button.submit').click(function(){
            $.ajax({
                type: 'post',
                url: '/setting/update-freight',
                data: $('.adminex-form').serializeArray(),
                dateType: 'json',
                success: function (response) {
                    if (response.code === 200) {
                        layer.alert(response.message);
                        window.location.reload();
                    } else {
                        layer.alert(response.message);
                    }
                }
            });
        });
    });
</script>